package com.ktjy.crm.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@TableName("sys_user")      //指定数据库表名
public class User implements Serializable {
    @TableId(type = IdType.AUTO)    //指定主键自增
    @TableField("usr_id")           //指定数据库字段名
    private Long usrId;
    @TableField("usr_name")
    private String usrName;
    @TableField("usr_password")
    private String usrPassword;
    @TableField("usr_role_id")
    private Long usrRoleId;
    @TableField("usr_flag")
    private Integer usrFlag;
    @TableField("create_time")
    private Date createTime;
    @TableField("update_time")
    private Date updateTime;

    @TableField(exist = false)
    private String roleName;

    @Version
    private Integer version;

    @TableLogic
    @TableField("deleted")
    private Integer deleted;  // 建议使用Integer而不是Boolean


    public User(String usrName, String usrPassword, Long usrRoleId, Integer usrFlag) {
        this.usrName = usrName;
        this.usrPassword = usrPassword;
        this.usrRoleId = usrRoleId;
        this.usrFlag = usrFlag;
    }

    public User(Long usrId, String usrName, String usrPassword, Long usrRoleId, Integer usrFlag) {
        this.usrId = usrId;
        this.usrName = usrName;
        this.usrPassword = usrPassword;
        this.usrRoleId = usrRoleId;
        this.usrFlag = usrFlag;
    }

    public User() {
    }

    public User(Long usrId, String usrName, String usrPassword, Long usrRoleId, Integer usrFlag, String roleName) {
        this.usrId = usrId;
        this.usrName = usrName;
        this.usrPassword = usrPassword;
        this.usrRoleId = usrRoleId;
        this.usrFlag = usrFlag;
        this.roleName = roleName;
    }

    public User(Long usrId, String usrName, String usrPassword, Long usrRoleId, Integer usrFlag, String roleName, Integer version) {
        this.usrId = usrId;
        this.usrName = usrName;
        this.usrPassword = usrPassword;
        this.usrRoleId = usrRoleId;
        this.usrFlag = usrFlag;
        this.roleName = roleName;
        this.version = version;
    }

    public User(Long usrId, String usrName, String usrPassword, Long usrRoleId, Integer usrFlag, String roleName, Integer version, Integer deleted) {
        this.usrId = usrId;
        this.usrName = usrName;
        this.usrPassword = usrPassword;
        this.usrRoleId = usrRoleId;
        this.usrFlag = usrFlag;
        this.roleName = roleName;
        this.version = version;
        this.deleted = deleted;
    }
}
